﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

namespace Simhopp.Common
{
    [Serializable]
    /// <summary>
    /// The Score class provides a score value and the credentials of the judge who committed the score.
    /// </summary>
    public class Score : ISerializable
    {
        private UserInfo judge;
        private double value;

        #region PROPERTY REGION
        public UserInfo Judge
        {
            get { return judge; }
            set { judge = value; }
        }
        public double Value
        {
            get { return value; }
            set { this.value = value; }
        }
        #endregion
        #region CONSTRUCTOR REGION
        /// <summary>
        /// Constructor taking arguments.
        /// </summary>
        /// <param name="judge">The judge who committed the score.</param>
        /// <param name="value">The value of the score.</param>
        public Score(UserInfo judge = null, double value = 0.0)
        {
            this.judge = judge;
            this.value = value;
        }
        #endregion
        #region SERIALIZE/DESERIALIZE REGION
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("Judge", judge, typeof(UserInfo));
            info.AddValue("Value", value, typeof(double));
        }
        public Score(SerializationInfo info, StreamingContext context)
        {
            judge = (UserInfo)info.GetValue("Judge", typeof(UserInfo));
            value = (double)info.GetValue("Value", typeof(double));
        }
        #endregion
        #region METHOD REGION
        public bool somefunc()
        {
            return false;
        }
        #endregion
    }
}
